package com.a85.wxhelper.db;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

/**
 * @author hejiangwei
 * @date 2018/7/11
 */
public class DataBaseDriver {

    Context mContext;
    SQLiteDatabase mDb;

    DataBaseDriver(Context context, String strPathName) {
        mContext = context;

            mDb = mContext.openOrCreateDatabase(strPathName, Context.MODE_PRIVATE, null);



    }

    boolean ExecuteSQL(String strSQL) {
        mDb.execSQL(strSQL);
        return true;
    }

    boolean execSQL(String strSQL, Object[] strValue) {
        mDb.execSQL(strSQL, strValue);
        return true;
    }

    Cursor QuerySQL(String strSQL) {
        if (mDb.isOpen()) {
        return mDb.rawQuery(strSQL, null);

        }else {
            return null;
        }
    }

    void DropDatabase(String strPathName) {
        mContext.deleteDatabase(strPathName);
    }

    void Close() {
        mDb.close();
    }
}
